From: Paul Donald Date: Tue, 2 Dec 2025 23:13:14 +0000 (+0100) Subject: file: bump sz_size to 64 bits X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=a284e7751fa76a0a9a5db3893e8abf335da89aaf;p=project%2Frpcd.git file: bump sz_size to 64 bits Some systems reveal /proc/kcore which for 64 bit systems has a size of 140,737,471,586,304 bytes. This is a virtual mapping of the maximum possible RAM in a system. But if a 32 bit value tries to hold this, it is displayed as the erroneous value -16,769,024 bytes Bump the size to 64 bits to hold the correct value (and correct values for large files). Before this patch: ubus call file list '{"path":"/proc"}' ... { "name": "kcore", "type": "file", "size": -16769024, "mode": 33024, "atime": 1764716086, "mtime": 1764716086, "ctime": 1764716086, "inode": -268435271, "uid": 0, "gid": 0, }, ... After this patch: ubus call file list '{"path":"/proc"}' ... { "name": "kcore", "type": "file", "size": 140737471586304, "mode": 33024, "atime": 1764716086, "mtime": 1764716086, "ctime": 1764716086, "inode": -268435271, "uid": 0, "gid": 0, }, ... Tested on: OpenWrt SNAPSHOT r32139-1f879b8839 / 6.12.59 Signed-off-by: Paul Donald Link: https://github.com/openwrt/rpcd/pull/22 Signed-off-by: Robert Marko --- diff --git a/file.c b/file.c index 89ba6b4..591ab6b 100644 --- a/file.c +++ b/file.c @@ -490,7 +490,7 @@ static void _rpc_file_add_stat(struct stat *s) { blobmsg_add_string(&buf, "type", d_types[_get_stat_type(s)]); - blobmsg_add_u32(&buf, "size", s->st_size); + blobmsg_add_u64(&buf, "size", s->st_size); blobmsg_add_u32(&buf, "mode", s->st_mode); blobmsg_add_u32(&buf, "atime", s->st_atime); blobmsg_add_u32(&buf, "mtime", s->st_mtime);